package com.shengsiyuan.awt;

import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class TwoListenAdapter {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		TwoListen test = new TwoListen();
		test.go();
	}
	private Frame frame;
	private TextField textField;
	public void go(){
		frame = new Frame("Two Listeners Example");
		frame.add(new Label("click"), BorderLayout.NORTH);
		textField = new TextField(30);
		frame.add(textField, BorderLayout.SOUTH);
		frame.setSize(300, 200);
		frame.setVisible(true);

		frame.addMouseListener(new MyAdapter());
		frame.addMouseListener(new MyMouseListener());

	}
}
class MyAdapter extends MouseAdapter{

	/* (non-Javadoc)
	 * @see java.awt.event.MouseAdapter#mouseEntered(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub
		String str = "The mouse has entered the frame";
		System.out.println(str);
	}

	/* (non-Javadoc)
	 * @see java.awt.event.MouseAdapter#mouseExited(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		String str = "The mouse has left the frame";
		System.out.println(str);
	}
	
}